package br.fatec.ads.decorator;

import org.displaytag.decorator.TableDecorator;

import br.fatec.ads.model.Cliente;

public class ClienteDecorator extends TableDecorator {
	public String getAtivoDescricao(){
		Cliente cliente = (Cliente) getCurrentRowObject();
		
		return cliente.getAtivo().equals("S") ? "Ativo" : "Inativo";
	}
	
	public String getLinkClienteConsultar(){
		Cliente cliente = (Cliente) getCurrentRowObject();
		
		String link = "<img src=\"img/grid_pesquisar.jpg\" " +
				"onclick=\"window.location='ClienteConsultar?idClienteConsultar=" + cliente.getIdCliente() + "'\" " +
						"style=\"cursor: pointer;\">";
		return link;
	}
	
	public String getLinkClienteAlterar(){
		Cliente cliente = (Cliente) getCurrentRowObject();
		
		String link = "<img src=\"img/grid_alterar.jpg\" " +
				"onclick=\"window.location='ClienteAlterar?idClienteAlterar=" + cliente.getIdCliente() + "'\" " +
						"style=\"cursor: pointer;\">";
		return link;
	}
	
	public String getLinkClienteExcluir(){
		Cliente cliente = (Cliente) getCurrentRowObject();
		
		String link = "<img src=\"img/grid_excluir.jpg\" " +
				"onclick=\"window.location='ClienteExcluir?idClienteExcluir=" + cliente.getIdCliente() + "'\" " +
						"style=\"cursor: pointer;\">";
		return link;
	}
}